<template>
        <el-container class="layout-container-demo" style="height: 700px">
            <el-aside width="200px">
            </el-aside>
            <el-container>
                <el-header >
                    <div style="text-align: center;font-size: 20px">中层干部考评系统</div>
                    <div class="topRight" style="text-align: right; font-size: 12px">
                        用户名:<span>{{nickname}}</span> 姓名:<span>{{realname}}</span>
                        <el-button type="danger" plain @click="logout()">退出登录</el-button>
                    </div>
                </el-header>
                <el-main>
                    <div v-show="page==''"><score1></score1></div>
                </el-main>
            </el-container>
        </el-container>

</template>
<script setup>
import { get } from '@/utils/request.js'
import {ElMessage} from 'element-plus'
import router from '@/router'
import { ref,onMounted } from 'vue'
import {userStore} from '@/stores/counter.js'
import { User, Message, Reading,Avatar,Folder,Monitor,DataBoard } from '@element-plus/icons-vue'
import score1 from '@/views/ScoreVue1.vue'
import { useRoute, useRouter } from 'vue-router';

const route = useRoute()
const nickname = ref('')
const realname = ref('')
const page = ref('')
const store=userStore()

console.log(route.params.id)

get('/user/getUser',(message)=>{
nickname.value=message.nickname
realname.value=message.realname
store.auth.user=message.nickname
store.auth.realname=message.realname
store.auth.role=message.role
})

const logout=()=>{
get('/api/auth/logout',(message)=>{
router.push('/')
ElMessage.success(message)
store.auth.user=null
store.auth.realname=null
auth.auth.role=null
})
}

const show=(index)=>{
page.value=index
}

</script>
<style scoped>
        .layout-container-demo .el-header {
  position: relative;
  background-color: var(--el-color-primary-light-7);
  color: var(--el-text-color-primary);
}
.layout-container-demo .el-aside {
  color: var(--el-text-color-primary);
  background: var(--el-color-primary-light-8);
}
.layout-container-demo .el-menu {
  border-right: none;
}
.layout-container-demo .el-main {
  padding: 0;
}
.layout-container-demo .toolbar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  right: 20px;
}
</style>